package a.f.h.a.b;

import a.c.*;
import a.c.d;
import a.c.k;
import a.c.m;
import a.c.n;
import a.f.j.cb;
import a.f.kc;
import a.f.o;
import a.f.wb;
import a.f.yb;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.Iterator;

public class p
  extends a.f.h.d.b
{
  public static int u;
  
  public p(n paramn)
  {
    this.k = paramn;
  }
  
  public void a(cb paramcb, k paramk) {}
  
  public void a(cb paramcb, k paramk, int paramInt)
  {
    boolean bool = b.i;
    int i = b.h;
    this.i = paramcb;
    this.p = paramInt;
    this.j = ((o)paramcb.a());
    this.l = this.j.B();
    this.m = null;
    this.j.a(a, this.l);
    m localm = this.j.w();
    do
    {
      if (!localm.e()) {
        break;
      }
      d locald = localm.a();
      ArrayList localArrayList = (ArrayList)this.k.get(locald);
      if (i != 0) {
        return;
      }
      if ((bool) || (localArrayList != null))
      {
        if (bool) {
          continue;
        }
        if (localArrayList.size() > 0)
        {
          this.r.addAll(localArrayList);
          if (bool) {
            continue;
          }
          if (this.m == null)
          {
            wb[] arrayOfwb = this.j.g(locald);
            if (bool) {
              continue;
            }
            if (arrayOfwb != null)
            {
              if (bool) {
                continue;
              }
              if (arrayOfwb.length > 0)
              {
                wb localwb = arrayOfwb[0];
                this.m = localwb.a();
              }
            }
          }
        }
      }
      localm.f();
    } while (i == 0);
    paramcb.a(this);
    if (!bool) {
      this.q = new yb();
    }
  }
  
  public void a(b paramb, cb paramcb, k paramk, ab paramab)
  {
    boolean bool = b.i;
    int i = b.h;
    this.i = paramcb;
    this.j = ((o)paramcb.a());
    this.l = this.j.B();
    this.m = null;
    this.j.a(a, this.l);
    m localm = paramab.l();
    do
    {
      if (!localm.e()) {
        break;
      }
      d locald = localm.a();
      ArrayList localArrayList = (ArrayList)this.k.get(locald);
      if (i != 0) {
        return;
      }
      if ((bool) || (localArrayList != null))
      {
        if (bool) {
          continue;
        }
        if (!localArrayList.isEmpty())
        {
          ab localab = paramb.d(locald);
          if (localab != null)
          {
            if (paramb.r(locald)) {
              a(localab, paramb);
            }
            b(locald, localab.p());
          }
          if ((bool) || (this.m == null))
          {
            wb[] arrayOfwb = this.j.g(locald);
            if (bool) {
              continue;
            }
            if (arrayOfwb != null)
            {
              if (bool) {
                continue;
              }
              if (arrayOfwb.length > 0) {
                this.m = arrayOfwb[0].a();
              }
            }
          }
        }
      }
      localm.f();
    } while (i == 0);
    if (!bool) {
      paramcb.a(this);
    }
  }
  
  private void a(ab paramab, b paramb)
  {
    boolean bool = b.i;
    int i = b.h;
    m localm = paramab.l();
    do
    {
      if (!localm.e()) {
        break;
      }
      d locald = localm.a();
      if (!bool)
      {
        if (paramb.p(locald)) {
          paramab.b(localm);
        }
        localm.f();
      }
    } while (i == 0);
  }
  
  private void b(d paramd, d[] paramArrayOfd)
  {
    boolean bool = b.i;
    int j = b.h;
    ArrayList localArrayList1 = (ArrayList)this.k.get(paramd);
    if (((bool) || (localArrayList1 != null)) && ((bool) || (!localArrayList1.isEmpty())))
    {
      if (bool) {
        break label58;
      }
      if (paramArrayOfd.length != 0) {}
    }
    else
    {
      return;
    }
    label58:
    if (!bool)
    {
      if (paramArrayOfd.length == 1) {
        this.k.a(paramArrayOfd[0], localArrayList1);
      }
    }
    else if (j == 0) {
      return;
    }
    ArrayList localArrayList2 = new ArrayList();
    ArrayList localArrayList3 = new ArrayList();
    ArrayList localArrayList4 = new ArrayList();
    Object localObject1 = localArrayList1.iterator();
    Object localObject2;
    int i;
    label218:
    label221:
    do
    {
      do
      {
        do
        {
          do
          {
            if (!((Iterator)localObject1).hasNext()) {
              break label221;
            }
            localObject2 = (kc)((Iterator)localObject1).next();
            i = ((kc)localObject2).g().a();
            if (j != 0) {
              break label229;
            }
            if (i != 1) {
              break;
            }
            localArrayList2.add(localObject2);
          } while ((!bool) && (j == 0));
          if (bool) {
            break label218;
          }
          if (i != 2) {
            break;
          }
          localArrayList4.add(localObject2);
          if (bool) {
            break label218;
          }
        } while (j == 0);
        localArrayList3.add(localObject2);
      } while (j == 0);
    } while (bool);
    if (paramArrayOfd.length == 2)
    {
      label229:
      this.k.a(paramArrayOfd[0], localArrayList2);
      localArrayList3.addAll(localArrayList4);
      this.k.a(paramArrayOfd[1], localArrayList3);
      if (j == 0) {}
    }
    else
    {
      localObject1 = paramArrayOfd[0];
      localObject2 = paramArrayOfd[(paramArrayOfd.length - 1)];
      i = (paramArrayOfd.length + 1) / 2 - 1;
      d locald = paramArrayOfd[i];
      this.k.a(localObject1, localArrayList2);
      this.k.a(localObject2, localArrayList4);
      this.k.a(locald, localArrayList3);
    }
  }
  
  static class a_
    implements Comparator
  {
    private static final int a = 0;
    private static final int b = 1;
    private static final int d = 2;
    
    public int compare(Object paramObject1, Object paramObject2)
    {
      boolean bool = b.i;
      kc localkc1 = (kc)paramObject1;
      kc localkc2 = (kc)paramObject2;
      int i = a(localkc1.g().a());
      int j = a(localkc2.g().a());
      if (!bool)
      {
        if (i < j) {
          return -1;
        }
        if (bool) {}
      }
      else if (i > j)
      {
        return 1;
      }
      return 0;
    }
    
    private int a(int paramInt)
    {
      boolean bool = b.i;
      if (!bool)
      {
        if (paramInt == 1) {
          return 0;
        }
        if (bool) {}
      }
      else if (paramInt == 2)
      {
        return 2;
      }
      return 1;
    }
  }
}



/* Location:           E:\idea\

 * Qualified Name:     a.f.h.a.b.p

 * JD-Core Version:    0.7.0.1

 */